<form id="deleteForm" name="form" action="{$modal.href}" method="post" class="nyroModal">
{t assignTo=title}Save as layout{/t}
{include file="$MODULES_DIR/backoffice/templates/block/modal/ModalTitle.html" title=$title}
<div id="modalContent">
	 <table class="listTable">  
        <tr>
            <th colspan="2">{t}Save as new{/t}</th>
        </tr>
        <tr>
            <td>{t}Label{/t}</td>
            <td><input id="label" type="text" name="form[label]" class="medium" onkeyup="disable();"/> {if isset($errors.label)}{icon name="warning.png"} {$errors.label}{/if}</td>
        </tr>
        {if count($layouts) > 0}
        <tr>
            <th colspan="2">{t}Save on existant{/t}</th>
        </tr>
        <tr>
            <td>{t}Layout{/t}</td>
            <td>
                <select id="layout" name="form[layout]" onchange="disable();">
                    <option value="0">---</option>
                    {foreach from=$layouts item=layout}
                    <option value="{$layout->getUniqueId()}">{$layout->getLabel()}</option>
                    {/foreach}
                </select>
            </td>
        </tr>
        {/if}
	</table>
</div>
{include file="$MODULES_DIR/backoffice/templates/block/modal/ModalFooter.html"}
</form>

<script type="text/javascript">
    {literal}
    function disable()
    {
        if($('#layout').is(':visible'))
        {
            if($('#label').val() != '')
            {
                $('#layout').attr("disabled", true);
            }
            else
            {
                $('#layout').removeAttr('disabled');
            }

            if($('#layout').val() != '0')
            {
                $('#label').attr("disabled", true);
            }
            else
            {
                $('#label').removeAttr('disabled');
            }
        }
    }
    {/literal}
</script>